package meminin.id3;

import meminin.model.DataRecord;

public class ID3InferenceEngine {

    public ID3InferenceEngine() {
    }

    public String inferenceClass(ID3Node model, DataRecord data) {
        ID3Node currNode = model;
        while (currNode.isBranch()) {
            String transitionValue = data.getAttributeValue(currNode.getClassLabel().getDesc());
            if (transitionValue == null) {
                return "";
            } else {
                currNode = currNode.getChildFromValue(transitionValue);
            }
        }
        return currNode.getClassLabelValue();
    }
}
